-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Farras Andriawan #7
base: master
Are you sure you want to change the base?
Conversation
client/index.html
Outdated
axios({ | ||
method: 'GET', | ||
url: 'http://localhost:3000/posts/' | ||
}).then((response)=>{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
catch tetap perlu di handle
client/index.html
Outdated
axios({ | ||
method: 'DELETE', | ||
url: 'http://localhost:3000/posts/' + post._id, | ||
}).then(res =>{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
catch tetap perlu di handle jika error
client/index.html
Outdated
<form v-show="showForm" id="article-form"> | ||
<label>Article title</label><br> | ||
<input type="text" name="title" id="form-title" v-model="form.title"><br> | ||
<p>{{form.description}}</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tidak perlu di tampilkan disini state nya form description etc
client/index.html
Outdated
createdAt: new Date() | ||
} | ||
}).then(()=>{ | ||
console.log('success') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
habis selesai submit di handle pesan sukses / errornya && form di reset dan ditutup kembali
client/index.html
Outdated
app.submitData(); | ||
}) | ||
*/ | ||
$('#btn-update-article').click(function(event){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kalo udah pake vue jquery untuk handle event tidak perlu dilakukan lagi
diselesaikan lagi ya kalo sudah sehat |
server/controllers/post.js
Outdated
} | ||
|
||
static delete(req,res){ | ||
Post.findByIdAndDelete({_id : req.params.id}).then(()=>{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentasi then catch perlu dirapihin lagi
server/controllers/post.js
Outdated
post | ||
}) | ||
}).catch((error)=>{ | ||
message : "failed adding post", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hasil error gak dikirim balik ke client
server/controllers/post.js
Outdated
Post.find().then((posts)=>{ | ||
res.json(posts) | ||
}).catch((err)=>{ | ||
console.log(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jgn cuman console.log
server/models/post.js
Outdated
type : String, | ||
required : true | ||
}, | ||
createdAt: Date |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ada opsi timestamps true
Added CSS